{% extends 'IcsocUIBundle::page.html.twig' %}
{% from 'IcsocUIBundle:Macro:grid.html.twig' import gridWidth,gridNav,gridConfig %}
{% from 'IcsocUIBundle:Macro:actions.html.twig' import timebutton,searchtime,searchForm,searchFormBtn %}

{% block stylesheet %}
    {{ parent() }}
    {% stylesheets
    '@jquery_ui_css'
    '@datepicker_css'
    '@jqgird_css'
    '@gritter_css'
    filter='cssrewrite' filter='uglifycss'
    %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

{% block content %}
    <h3 class="header smaller lighter green">分机注册信息查询:</h3>
    <p></p>
    <table class="table table-bordered table-hover no-padding">
        <tbody>
        <tr>
            <td class="col-xs-1 align-right align-middle" style="border-right-width: 0px;">
                <label for="phone">分机号码:</label>
            </td>
            <td class="col-xs-2" style="border-left-width: 0px;border-right-width: 0px;">
                <input type="text" id="phone" class="col-sm-12" placeholder="" value="">
            </td>
            <td class="col-xs-1 align-right align-middle" style="border-left-width: 0px;border-right-width: 0px;"></td>
            {#<td class="col-xs-1 align-right align-middle" style="border-left-width: 0px;border-right-width: 0px;">
                <label for="phonetype">注册状态:</label>
            </td>
            <td class="col-xs-2" style="border-left-width: 0px;border-right-width: 0px;">
                <input type="text" id='phonetype' class="col-sm-12" placeholder="" value="">
            </td>#}
            <td class="col-xs-6" style="border-left-width: 0px;border-right-width: 0px;">
                <button onclick="search()" class="btn btn-info btn-sm">
                    <i class="ace-icon fa fa-search"></i> 查询
                </button>
                {#<button class="btn btn-pink btn-sm" onclick="resetBtn()">
                    <i class="ace-icon fa fa-undo"></i> 重 置
                </button>#}
            </td>
        </tr>
        </tbody>
    </table>
    <table id="grid-table"></table>
    <div id="grid-pager"></div>
{% endblock %}

{% block footer %}
    {% javascripts
    '@datepicker_js'
    '@jqgird_js'
    '@gritter_js'
    '@common_js'
    '@jquery_ui_js'
    filter='uglifyjs'
    %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
    <script type="text/javascript">
        var phone,phonetype;

        jQuery(function($) {
            {{ gridWidth() }}
            jQuery(grid_selector).jqGrid({
                caption: "分机注册信息表",
                url: "{{ path('icsoc_security_develop_phone_info_data') }}",
                mtype: 'POST',
                datatype: "json",
                hidegrid:false,
                height: '100%',
                colModel:[
                    {name:'pho_num' , index:'pho_num' , label: '分机号码' , width:100 , sortable:true , fixed:true},
                    {name:"cur_now", index:'cur_now', label: '注册状态' , width:100, sortable:false},
                    {name:"ag_name", index:'ag_name', label: '坐席名称' , width:100, sortable:false},
                    {name:"ag_num", index:'ag_num', label: '坐席号码' , width:100, sortable:false},
                    {name:'cur_time' , index:'cur_time', formatter:'date', formatoptions:{srcformat: 'U', newformat:'Y-m-d H:i:s'}, label: '注册时间' , width:80 , sortable:false },
                    {name:"realm", index:'realm', label: '注册服务器' , width:100, sortable:false},
                    {name:"ping_ms", index:'ping_ms', label: '网络延迟(ms)' , width:100, sortable:false},
                    {name:"src_host", index:'src_host', label: '分机注册IP' , width:100, sortable:false}
                ],
                {{ gridConfig() }}
                rowNum:10,
                rowList: [10,20,30,50,100],
                rownumWidth: 40,
                viewrecords: true,
                multiselect: false,
                sortname:"id",
                sortorder:'desc'
            });
            {{ gridNav(false,false,false,false,true) }}
        });

        //搜索
        function search()
        {
            getCondition();
            $('#grid-table').setGridParam({
                page:1,
                postData:{'phone':phone,'phonetype':phonetype}
            }).trigger("reloadGrid");
        }

        /*//重置
        function resetBtn()
        {
            phone = $('#phone').val('');
            //phonetype = $('#phonetype').val('');
            search();
        }*/
        //获得搜索条件
        function getCondition()
        {
            phone = $('#phone').val();
            //phonetype = $('#phonetype').val();
        }
    </script>
{% endblock %}